-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Solution #1633
base: master
Are you sure you want to change the base?
Solution #1633
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your code meets the task requirements and constraints effectively! 🎉 While there are some areas for improvement, such as handling potential name conflicts and ensuring the validity of names when setting wife
and husband
attributes, these do not critically impact the functionality. Keep up the great work, and consider these suggestions for future enhancements to make your code even more robust! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
@@ -1,8 +1,31 @@ | |||
class Person: | |||
# write your code here | |||
pass | |||
people = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The people
dictionary is used to store instances of Person
by name. This approach assumes that all names are unique, which might not be the case. Consider handling potential name conflicts or using a different identifier.
if "wife" in one and one["wife"]: | ||
person.wife = Person.people.get(one["wife"]) | ||
elif "husband" in one and one["husband"]: | ||
person.husband = Person.people.get(one["husband"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic for setting wife
and husband
attributes assumes that the provided names are always valid and present in the Person.people
dictionary. Consider adding error handling or validation to ensure that the names exist in the dictionary before accessing them.
No description provided.